package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;

/**
 * Created by yanwt on 2017/3/27.
 */
@Getter
@Setter
@Entity
@Table(name="tb_channel")
@org.hibernate.annotations.Table(appliesTo = "tb_channel",comment = "渠道来源")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="channel", usage = CacheConcurrencyStrategy.READ_WRITE)
public class ChannelEntity extends DataEntity{

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "company_id", insertable = false, updatable = false, columnDefinition = ("bigint(20) default null comment '公司ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private OfficeEntity office;

    @Column(name = "company_id", columnDefinition = ("bigint(20) not null comment '公司ID'"))
    private Long companyId;

    @Column(columnDefinition=("varchar(200) default null comment '名称'"))
    private String name;

    @Column(name = "qr_code",columnDefinition=("varchar(255) default null comment '二维码地址'"))
    private String qrCode;

    @Column(name="status",columnDefinition = ("int(1) not null comment '状态 0:新建，1:审核，-1:作废'"))
    private int status;
}
